<?php
namespace app\helper\tools;

use \PhpOffice\PhpSpreadsheet\Reader\IReadFilter;

class ExcelReadFilter implements IReadFilter
{
    private $startRow = 0;
    private $endRow   = 0;

    public function setRows($startRow, $chunkSize, $offset = 0)
    {
        $this->startRow = $startRow + $offset;
        $this->endRow   = $this->startRow + $chunkSize;
    }

    public function readCell($column, $row, $worksheetName = '')
    {
        if ($row >= $this->startRow && $row < $this->endRow) {
            return true;
        }
        return false;
    }
}